function updateComment(id){
	var balise = '#comment' + id;
	$.post("../modules/controllers/comments_controller.php", {id_comment : id, func : 1}, function(data){
		  $(balise).html(data);
		  });
}

function deleteComment(id){
	if(confirm('Etes vous sûr ?') == true){
		var balise = '#comment' + id;
		$.post("../modules/controllers/comments_controller.php", {id_comment : id, func : 7}, function(data){
			  $(balise).html(data);
			  });
	}
}

function newCommentEvent(poster, idEvent){
	var comment = document.getElementById("new_text").value;
	$.post("../modules/controllers/comments_controller.php", {id_event : idEvent, id_owner : poster, text : comment, func : 8}, function(data){
		  $('#comments').prepend(data);
		  });
}

function newCommentUser(poster, idUser){
	var comment = document.getElementById("new_text").value;
	$.post("../modules/controllers/comments_controller.php", {id_user : idUser, id_owner : poster, text : comment, func : 6}, function(data){
		  $('#comments').prepend(data);
		  });
}

function printMoreCommentsUser(id_user, id_poster){
	var comment = parseInt(document.getElementById("nbComment").value) + 3;
	$.post("../modules/controllers/comments_controller.php", {comment : comment, func : 4}, function(data){
		  $('#hiddenNbComment').html(data);
		  });
	$.post("../modules/controllers/comments_controller.php", {nb_comment : comment, id_user : id_user, id_poster : id_poster, func : 3}, function(data){
		  $('#comments').append(data);
		  });
}

function printMoreCommentsEvent(id_event, id_poster){
	var comment = parseInt(document.getElementById("nbComment").value) + 3;
	$.post("../modules/controllers/comments_controller.php", {comment : comment, func : 4}, function(data){
		  $('#hiddenNbComment').html(data);
		  });
	$.post("../modules/controllers/comments_controller.php", {nb_comment : comment, id_event : id_event, id_poster : id_poster, func : 9}, function(data){
		  $('#comments').append(data);
		  });
}

function cancelUpdate(idComment){
	var balise = '#comment' + idComment;
	$.post("../modules/controllers/comments_controller.php", {id_comment : idComment, func : 2}, function(data){
		  $(balise).html(data);
		  });
}

function confirmUpdateComment(idComment){
	var balise = '#comment' + idComment;
	var comment = document.getElementById("newText").value;
	$.post("../modules/controllers/comments_controller.php", {id_comment : idComment, new_text : comment, func : 5}, function(data){
		  $(balise).html(data);
		  });	
}